from scipy import linalg
import numpy as np
A = np.array(
    [
        [1, 9, 2, 1, 1],
        [10, 1, 2, 1, 1],
        [1, 0, 5, 1, 1],
        [2, 1, 1, 2, 9],
        [2, 1, 2, 13, 2],
    ]
)
print(A)
print(linalg.det(A))  # 行列式的值

B = np.array([170, 180, 140, 180, 350]).reshape((5, 1))
print(B)
A_inv = linalg.inv(A)
X = A_inv @ B  # 矩阵乘法用@，
# 逐元素乘法用*，矩阵的哈达玛积(hadamard product)：两个相乘的矩阵维度一致
# 逐元素相乘（也叫矩阵点乘，element-wise product ,entrywise product ）
print(X)

print(A@X)
